﻿using ELTE.SEM.Common.Enums;
using ELTE.SEM.Data.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ELTE.SEM.Data
{
    public static class LogEntryPartEx
    {
        public static SEMLogEntryPartViewModel GetViewModel(this LogEntryPart entryPart)
        {
            //SemLogEntryPartType partType = SemLogEntryPartType.SampleReplace
            return new SEMLogEntryPartViewModel
            {
                Id = entryPart.Id,
                EntryPartAddedBy = entryPart.EntryPartAddedByUser == null ? "N/A" : entryPart.EntryPartAddedByUser.Name,
                Client = entryPart.Client == null ? "N/A" : entryPart.Client.ClientName,
                EntryPartBegin = entryPart.EntryPartBegin,
                EntryPartType = (SemLogEntryPartType)entryPart.EntryPartTypeId,
                ErrorDescriptions = entryPart.ErrorDescription,
                RepairDescriptions = entryPart.RepairDescriptions,
                SampleIdentifier = entryPart.SampleIdentifier,
                PartDescriptions = entryPart.EntryPartDescription,
                LogEntryId = entryPart.LogEntryId,
            };
        }
    }
}
